home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / f90 / unpack.z / unpack
Encoding:
Text File  |  2002-10-03  |  2.7 KB  |  79 lines

  1. UNPACK(3I)                                            Last changed: 4-13-99
  2.  
  3.  
  4. NNAAMMEE
  5.      UUNNPPAACCKK - Unpacks an array of rank one into an array under control of a
  6.      mask
  7.  
  8. SSYYNNOOPPSSIISS
  9.      UUNNPPAACCKK (([VVEECCTTOORR==]_v_e_c_t_o_r,, [MMAASSKK==]_m_a_s_k,, [FFIIEELLDD==]_f_i_e_l_d))
  10.  
  11. IIMMPPLLEEMMEENNTTAATTIIOONN
  12.      UNICOS, UNICOS/mk, IRIX systems
  13.  
  14.      CF90, MIPSpro 7 Fortran 90
  15.  
  16. SSTTAANNDDAARRDDSS
  17.      Fortran
  18.  
  19. DDEESSCCRRIIPPTTIIOONN
  20.      The UUNNPPAACCKK intrinsic function unpacks an array of rank one into an
  21.      array under control of _m_a_s_k.  It accepts the following arguments:
  22.  
  23.      _v_e_c_t_o_r    Can be of any type.  It must have rank one.  Its size must
  24.                be at least _t where _t is the number of true elements in
  25.                _m_a_s_k.
  26.  
  27.      _m_a_s_k      Must be of type logical and array valued.
  28.  
  29.      _f_i_e_l_d     Must be of the same type as _v_e_c_t_o_r, and must be conformable
  30.                with _m_a_s_k.
  31.  
  32.      UUNNPPAACCKK is a transformational function.  The name of this intrinsic
  33.      cannot be passed as an argument.
  34.  
  35. RREETTUURRNN VVAALLUUEESS
  36.      The result is an array of the same type as _v_e_c_t_o_r and the same shape
  37.      as _m_a_s_k.
  38.  
  39.      The element of the result that corresponds to the _ith true element of
  40.      _m_a_s_k, in array element order, has the value _v_e_c_t_o_r(_i) for _i=1, 2, ...,
  41.      _t where _t is the number of true values in _m_a_s_k.  Each other element
  42.      has the value equal to _f_i_e_l_d if _f_i_e_l_d is scalar or to the
  43.      corresponding element of _f_i_e_l_d if it is an array.
  44.  
  45. EEXXAAMMPPLLEESS
  46.      This example uses UUNNPPAACCKK to scatter specific values to specific
  47.      positions in an array.
  48.  
  49.      Assume that MM is the following array:
  50.  
  51.           | 1 0 0 |
  52.           | 0 1 0 |
  53.           | 0 0 1 |
  54.  
  55.      Assume that VV is the array [1, 2, 3].
  56.  
  57.      Assume that QQ is the logical mask:
  58.  
  59.           | F T F |
  60.           | T F F |
  61.           | F F T |
  62.  
  63.      In logical mask QQ, TT represents true and FF represents false, so
  64.      UUNNPPAACCKK((VV,, MMAASSKK==QQ,, FFIIEELLDD==MM)) has the following value:
  65.  
  66.           | 1 2 0 |
  67.           | 1 1 0 |
  68.           | 0 0 3 |
  69.  
  70.      The result of UUNNPPAACCKK((VV,, MMAASSKK==QQ,, FFIIEELLDD==00)) has the following value:
  71.  
  72.           | 0 2 0 |
  73.           | 1 0 0 |
  74.           | 0 0 3 |
  75.  
  76. SSEEEE AALLSSOO
  77.      _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l for the printed version of this
  78.      man page.
  79.